package com.base.engine.graphics;

import java.io.IOException;

import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;

import com.base.engine.error.TextureException;

public final class MADTextureLoader {
	
	public static Texture loadTexture(String filePath){
		int x = filePath.lastIndexOf('.'); 
		String fileExt = filePath.substring(x+1, filePath.length());
		fileExt = fileExt.toUpperCase(); 
		System.out.println(fileExt);
		try {
			return TextureLoader.getTexture(fileExt, ResourceLoader.getResourceAsStream(filePath));
		} catch (IOException e) {
			TextureException.TextureLoadingException(); 
		}
		return null ; 
	}

}
